<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>初始化Vue项目</title>
  <script type="text/javascript" src="./js/vue.js"></script>
</head>

<body>
  <div id="root">
    <h1>{{msg}}</h1>
    <school></school>
  </div>
</body>
<script type="text/javascript">
  Vue.config.productionTip = false;


  const school = Vue.extend({
    template: `
    <div><h2>人员列表: {{name}}</h2>
      <h2>人员地址: {{address}}</h2></div>`
    , data() {
      return {
        name: '张归纳',
        address: '北京市海淀区'
      }
    }
  });
  const vm = new Vue({
    data() {
      return {
        msg: 'hello world'
      }
    },
    components: {
      school
    }
  },)
  // // watch: {
  //   name: {
  //     immediate: true,
  //     handler(val) {
  //       console.log('被修改了', val)
  //       this.persions = this.persion.filter((p) => {
  //         return p.name.indexOf(val) !== -1
  //       })
  //     }
  //   }
  // }
  // computed: {
  //   persions() {
  //     const arr = this.persion.filter((p) => {
  //       return p.name.indexOf(this.name) !== -1
  //     })
  //     if (this.sortType) {
  //       arr.sort((a, b) =>
  //         (this.sortType === 1 ? a.age - b.age : b.age - a.age)
  //       )
  //     }
  //     return arr
  //   }
  // }

  vm.$mount("#root")
</script>

</html>